Adjust truesize in netfront to more closely reflect real data payload
authorack@localhost.localdomain <ack@localhost.localdomain>
Tue, 15 Aug 2006 10:13:04 +0000 (11:13 +0100)
committerack@localhost.localdomain <ack@localhost.localdomain>
Tue, 15 Aug 2006 10:13:04 +0000 (11:13 +0100)
plus supervisor overheads but keeping out gross hypervisor overheads.
Signed-off-by: Emmanuel Ackaouy <ack@xensource.com>
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c

index 26745de79a7759202f0f00a6db7b8da91f413252..d1c324db2b3f22a63d2758a9413644f58ba1022c 100644 (file)
@@ -1199,7 +1199,28 @@ err:
                }
 
                i = xennet_fill_frags(np, skb, &tmpq);
-               skb->truesize += skb->data_len;
+
+        /*
+         * Truesize must approximates the size of true data plus
+         * any supervisor overheads. Adding hypervisor overheads
+         * has been shown to significantly reduce achievable
+         * bandwidth with the default receive buffer size. It is
+         * therefore not wise to account for it here.
+         *
+         * After alloc_skb(RX_COPY_THRESHOLD), truesize is set to
+         * RX_COPY_THRESHOLD + the supervisor overheads. Here, we
+         * add the size of the data pulled in xennet_fill_frags().
+         *
+         * We also adjust for any unused space in the main data
+         * area by subtracting (RX_COPY_THRESHOLD - len). This is
+         * especially important with drivers which split incoming
+         * packets into header and data, using only 66 bytes of
+         * the main data area (see the e1000 driver for example.)
+         * On such systems, without this last adjustement, our
+         * achievable receive throughout using the standard receive
+         * buffer size was cut by 25%(!!!).
+         */
+               skb->truesize += skb->data_len - (RX_COPY_THRESHOLD - len);
                skb->len += skb->data_len;
 
                /*